package com.zhouxiaoge.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author 周小哥  gqzmy@163.com 2022/8/12 23:13
 * <p>
 * 从Socket读取数据
 */

public class SocketSourceTest {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        DataStreamSource<String> source = env.socketTextStream("k8smaster", 7777);

        source.print();

        env.execute();
    }
}
